USE [yy_job]
GO

/****** Object:  Table [dbo].[yy_job]    Script Date: 1/22/2024 3:36:10 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[yy_job](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[project_code] [varchar](64) NOT NULL,
	[module_code] [varchar](64) NOT NULL,
	[module_name] [varchar](64) NOT NULL,
	[job_code] [varchar](64) NOT NULL,
	[job_name] [varchar](64) NOT NULL,
	[job_status] [char](1) NOT NULL,
	[execute_type] [char](1) NOT NULL,
	[business_no] [varchar](64) NOT NULL,
	[expected_start_time] [datetime] NULL,
	[exec_time] [datetime] NULL,
	[exec_count] [int] NULL,
	[version] [int] NOT NULL,
	[creator] [varchar](64) NOT NULL,
	[gmt_created] [datetime] NOT NULL,
	[modifier] [varchar](64) NOT NULL,
	[gmt_modified] [datetime] NOT NULL,
	[is_deleted] [char](1) NOT NULL,
 CONSTRAINT [PK_yy_job] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'id'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'项目空间代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'project_code'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'模块代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'module_code'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'模块名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'module_name'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'job_code'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'job_name'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业状态，C创建，L锁定，F失败，S成功' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'job_status'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'任务执行方式(S:标准扫描执行;L:本地执行;P:优先级(立即)执行)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'execute_type'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'业务号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'business_no'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'设置启动时间，为空则表示立即启动' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'expected_start_time'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业最新执行时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'exec_time'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业执行次数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'exec_count'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'版本号，乐观锁用' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'version'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建者->对应ip和线程编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'creator'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'gmt_created'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改者->对应ip和线程编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'modifier'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'gmt_modified'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否删除 Y/N' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job', @level2type=N'COLUMN',@level2name=N'is_deleted'
GO


/****** Object:  Table [dbo].[yy_job_log]    Script Date: 11/2/2023 11:31:49 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[yy_job_log](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[job_id] [bigint] NOT NULL,
	[job_action] [char](1) NOT NULL,
	[exec_start_time] [datetime] NULL,
	[exec_end_time] [datetime] NULL,
	[manual_exec_user] [varchar](64) NULL,
	[err_msg] [varchar](512) NULL,
	[err_stack] [varchar](4096) NULL,
	[creator] [varchar](64) NOT NULL,
	[gmt_created] [datetime] NOT NULL,
	[modifier] [varchar](64) NOT NULL,
	[gmt_modified] [datetime] NOT NULL,
	[is_deleted] [char](1) NOT NULL,
 CONSTRAINT [PK_yy_job_log] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'id'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业id,yy_job表主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'job_id'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'动作' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'job_action'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'任务开始执行时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'exec_start_time'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'任务结束执行时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'exec_end_time'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'人工执行用户' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'manual_exec_user'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业执行错误信息' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'err_msg'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业执行错误堆栈' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'err_stack'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建者->对应ip和线程编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'creator'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'gmt_created'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改者->对应ip和线程编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'modifier'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'gmt_modified'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否删除 Y/N' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_log', @level2type=N'COLUMN',@level2name=N'is_deleted'
GO



/****** Object:  Table [dbo].[yy_job_step]    Script Date: 11/2/2023 11:32:26 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[yy_job_step](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[job_id] [bigint] NOT NULL,
	[step_code] [varchar](64) NOT NULL,
	[step_name] [varchar](64) NOT NULL,
	[step_status] [char](1) NOT NULL,
	[step_params] [varchar](2048) NULL,
	[step_order] [int] NULL,
	[exec_count] [int] NULL,
	[exec_time] [datetime] NULL,
	[creator] [varchar](64) NOT NULL,
	[gmt_created] [datetime] NOT NULL,
	[modifier] [varchar](64) NOT NULL,
	[gmt_modified] [datetime] NOT NULL,
	[is_deleted] [char](1) NOT NULL,
 CONSTRAINT [PK_yy_job_step] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'id'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业id, yy_job.id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'job_id'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'步骤代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'step_code'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'步骤名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'step_name'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'步骤状态，C创建，R运行，F失败，S成功' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'step_status'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'步骤参数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'step_params'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'步骤顺序' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'step_order'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'执行次数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'exec_count'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最新执行时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'exec_time'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建者->对应ip和线程编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'creator'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'gmt_created'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改者->对应ip和线程编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'modifier'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'gmt_modified'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否删除 Y/N' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step', @level2type=N'COLUMN',@level2name=N'is_deleted'
GO


/****** Object:  Table [dbo].[yy_job_step_log]    Script Date: 11/2/2023 11:32:49 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[yy_job_step_log](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[job_id] [bigint] NOT NULL,
	[job_log_id] [bigint] NOT NULL,
	[job_step_id] [bigint] NOT NULL,
	[exec_start_time] [datetime] NULL,
	[exec_end_time] [datetime] NULL,
	[job_step_result_flag] [char](1) NULL,
	[job_step_result] [varchar](1024) NULL,
	[err_msg] [varchar](512) NULL,
	[err_stack] [varchar](4096) NULL,
	[creator] [varchar](64) NOT NULL,
	[gmt_created] [datetime] NOT NULL,
	[modifier] [varchar](64) NOT NULL,
	[gmt_modified] [datetime] NOT NULL,
	[is_deleted] [char](1) NOT NULL,
 CONSTRAINT [PK_yy_job_step_log] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'id'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'任务id,yy_job.id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'job_id'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'任务日志id,yy_job_log.id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'job_log_id'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'步骤id,yy_job_step.id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'job_step_id'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'步骤执行开始时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'exec_start_time'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'步骤执行结束时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'exec_end_time'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'步骤执行结果(Y:成功,N:失败)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'job_step_result_flag'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'步骤执行结果，执行器返回的JobResult对象' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'job_step_result'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'步骤执行结果，执行器返回的JobResult对象' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'err_msg'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'步骤执行错误堆栈，执行过程中异常抛出来的' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'err_stack'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建者->对应ip和线程编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'creator'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'gmt_created'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改者->对应ip和线程编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'modifier'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'修改时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'gmt_modified'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否删除 Y/N' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'yy_job_step_log', @level2type=N'COLUMN',@level2name=N'is_deleted'
GO




